<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
//    var reg = /(?<!2000|xp)window/ig;
        var reg = new RegExp('(?<!2000|xp)window','ig');
    var s = '2000window 3000window XPwindow';//021 23442344

       var r2 = s.replace(reg,function($0){//根据auguments推出的，参数的个数与正则中括号的个数成一定关系
            console.log($0)
           return '';
       });
    console.log(r2);
</script>
</body>
</html>